package com.ysu.yybk.util;

import com.ysu.yybk.VO.ResultVO;
import com.ysu.yybk.VO.old.OldResultVO;

public class ResultVOUtil {

    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setData(object);
        resultVO.setCode(0);
        resultVO.setMsg("成功");
        return resultVO;
    }

    public static ResultVO success() {
        return success(null);
    }

    public static ResultVO error(Integer code, String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }

    public static OldResultVO oldError(Integer code){
        OldResultVO oldResultVO = new OldResultVO();
        oldResultVO.setErrorCode(code);
        return oldResultVO;
    }

    public static OldResultVO oldSuccess(){
        OldResultVO oldResultVO = new OldResultVO();
        oldResultVO.setErrorCode(0);
        return oldResultVO;
    }
}
